package tool;

import base.TreeNode;

import java.util.ArrayList;
import java.util.List;

public class PrintTool {

    public static List<Integer> treeNode(TreeNode node) {
        List<Integer> list = new ArrayList<Integer>();
        treeNode(node, list);
        return list;
    }

    public static List<Integer> treeNode(TreeNode node, List<Integer> list) {

        if(node == null) {
            // list.add(null);
            return list;
        }
        list.add(node.val);
        treeNode(node.left, list);
        treeNode(node.right, list);
        return list;
    }
}
